{% extends "view/admin/ext_admin.html" %}
{% block extadmin %}



                        <section class="panel panel-default">

                            <header class="panel-heading text-right bg-light  clearfix">
                                <ul class="nav nav-tabs pull-left">
                                    <li ><a href="/{{ctx.controller}}/index"  class="grouplist"> {{controller.meta_title}}</a></li>
                                    <li class="active"><a href="javascript:void(0)"  class="grouplist"> {{space.name}}</a></li>
                                </ul>
                            </header>

                            <div class="row wrapper">

                                <div class="col-sm-12 m-b-xs">
                                    <a href="/{{ctx.controller}}/addad/?spaceid={{space.spaceid}}" class="btn btn-s-md btn-primary" >添加广告</a>
                                    <a href="/{{ctx.controller}}/adcache" class="btn btn-s-md btn-dark ajax-get">更新广告缓存</a>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped b-t b-light">
                                    <thead>
                                    <tr>
                                        <th style="width:20px;"><label class="checkbox m-n i-checks"><input type="checkbox"><i></i></label></th>
                                        <th style="width:60px;">ID</th>
                                        <th style="width:80px;">排序</th>
                                        <th style="">广告名称</th>
                                        <th class="">广告类型</th>
                                        <th class="">所属广告位</th>
                                        <th class="">状态</th>
                                        <th class="">点击数</th>
                                        <th class="">添加时间</th>
                                        <th >操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for item in list %}
                                    <tr>
                                        <td><label class="checkbox m-n i-checks"><input class="ids" type="checkbox" name="ids" value="{{item.id}}"><i></i></label></td>
                                        <td>{{item.id}}</td>
                                        <td><input class="form-control form-control-text sort" value="{{item.sort}}" name="sort" data-id="{{item.id}}"/></td>
                                        <td>{{item.name}}</td>
                                        <td>{%if item.type=='images'%}
                                            图片
                                            {%elif item.type=='flash'%}
                                            动画
                                            {%elif item.type=='text'%}
                                            文字
                                            {%else%}
                                            代码
                                            {%endif%}</td>
                                        <td>{{space.name}}</td>
                                        <td>{%if item.status==1%}启用{%else%}禁用{%endif%}</td>
                                        <td>{{item.hits}}</td>
                                        <td>{{item.addtime|moment('YYYY-MM-DD HH:mm:ss')}}</td>
                                        <td>

                                            <a href="/{{ctx.controller}}/editad/?id={{item.id}}" class="text-info" >修改</a>
                                            <a href="/{{ctx.controller}}/delad/?ids={{item.id}}" class="confirm ajax-get text-info">删除</a>
                                            {#<a href="/{{ctx.controller}}/tj" class="confirm ajax-get text-info">统计</a>#}

                                        </td>


                                    </tr>
                                    {% else %}
                                    <tr><td colspan="10"><div class="alert alert-warning alert-block">
                                        <button data-dismiss="alert" class="close" type="button">×</button>
                                        <p>This would display if the 'item' collection were empty</p>
                                    </div></td></tr>

                                    {% endfor %}


                                    </tbody>
                                </table>
                            </div>
                            <footer class="panel-footer">
                                <div class="row">

                                    <div class="col-sm-6 text-center-xs">
                                        <div class="btn-group">
                                            <a href="/{{ctx.controller}}/sort" class="btn btn-default ajax-post" target-form="sort">排序</a>
                                            <a href="/{{ctx.controller}}/setstatus/?model=ext_ad&status=1" class="btn btn-default ajax-post" target-form="ids">启用</a>
                                            <a href="/{{ctx.controller}}/setstatus/?model=ext_ad&status=0" class="btn btn-default ajax-post" target-form="ids">停用</a>
                                            <a href="/{{ctx.controller}}/delad" class="btn btn-default ajax-post confirm" target-form="ids">删除</a>
                                        </div>
                                    </div>

                                    <div class="col-sm-6 text-right text-center-xs">
                                        {{pagerData | safe}}
                                    </div>
                                </div>
                            </footer>
                        </section>


{% endblock %}
